package com.museum.controller.APi.feignAPI.impl;

import com.alibaba.fastjson.JSONObject;
import com.museum.base.BaseApiService;
import com.museum.base.BaseResponse;
import com.museum.controller.APi.feignAPI.FeignLogController;

import com.museum.entity.FIND.QueryDepLog;

import com.museum.mapper.QueryDepLogMapper;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.RestController;

@RestController
public class FeignLogControllerImpl extends BaseApiService<JSONObject> implements FeignLogController {
   @Autowired
   private QueryDepLogMapper mapper;

//    @Override
//    public BaseResponse<JSONObject> addLog(QueryDepLog depLog) {
//        int result = mapper.insert(depLog);
//        JSONObject object = new JSONObject();
//        object.put("result", result);
//        return setResultSuccess(object);
//
//    }

    @Override
    public BaseResponse<JSONObject> addLog(String depository, String ioTime, String ioType, String note, String itemName, String logType,Integer areaNumber) {
            QueryDepLog depLog = new QueryDepLog();
            depLog.setDepository(depository);
            depLog.setIoTime(ioTime);
            depLog.setIoType(ioType);
            depLog.setNote(note);
            depLog.setItemName(itemName);
            depLog.setLogType(logType);
            depLog.setTitle(itemName+ioType);
            depLog.setAreaNumber(areaNumber);
            int result = mapper.insert(depLog);
            JSONObject object = new JSONObject();
            object.put("result",result);

        return setResultSuccess(object);
    }

    @Override
    public BaseResponse<JSONObject> testLog(String test) {
        JSONObject object = new JSONObject();
        object.put("test",test);
        return setResultSuccess(object);
    }


}
